<?php
	function smarttemplate_extension_recursion_comment( $quote_comment ,$quotenums=0)
        {
		global $quote_level;
		$quote_level++;
		if($quotenums&&$quote_level>$quotenums) {
			$quote_level=0;
			return;
		}
		if(!$quote_comment['quote'])
			$quote_level=0;
		global $channel;
		if($channel&&file_exists("../../comment/templates/$channel/quote_comment.php"))							require("../../comment/templates/$channel/quote_comment.php");
		else if(file_exists("../../comment/templates/quote_comment_default.php"))
			require("../../comment/templates/quote_comment_default.php");
		else
			require(DOCUMENT_ROOT."templates/quote_comment_default.php");

		if ($quote_comment['usrname'] == "") {
			$quote_usrname = $quote_usrname_channel; 
		}
		else {
			$quote_usrname = $quote_comment['usrname']; 
		}
		$floor = "" ;
		if ($quote_comment['floor']) {
			$floor = $quote_comment_floor_channel_head.$quote_comment['floor'].$quote_comment_floor_channel_str ;
		}
		if ($quote_comment['content']) {
			if ($quote_comment['quote'] != 0) {
				$quote_str=$model_str_a;
				$quote_str=str_replace('[floor]', $floor, $quote_str);
				$quote_str=str_replace("[quote_usrname]", $quote_usrname, $quote_str);
				$quote_str=str_replace("[quote_comment_local]", $quote_comment['local'], $quote_str);
				$quote_str=str_replace("[recursion_comment]", smarttemplate_extension_recursion_comment($quote_comment['quote_comment'],$quotenums), $quote_str);
				$quote_str=str_replace("[quote_comment_content]", $quote_comment['content'], $quote_str);
			}
			else {
				$quote_str=$model_str_a;
				$quote_str=str_replace("[floor]", $floor, $quote_str);
				$quote_str=str_replace("[quote_usrname]", $quote_usrname, $quote_str);
				$quote_str=str_replace("[quote_comment_local]", $quote_comment['local'], $quote_str);
				$quote_str=str_replace("[recursion_comment]","", $quote_str);
				$quote_str=str_replace("[quote_comment_content]", $quote_comment['content'], $quote_str);
			}
		}
		
		$quote_str = $quote_str ;

		return $quote_str ;
        }
?>